package cn.wowjoy.pda.android_pharmacy.ui.activity.staticH;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import cn.wowjoy.pda.android_pharmacy.R;
import cn.wowjoy.pda.android_pharmacy.common.core.BaseActivity;
import cn.wowjoy.pda.android_pharmacy.common.utils.PreferenceManager;
import cn.wowjoy.pda.android_pharmacy.databinding.ActivityStaticTaskBinding;
import cn.wowjoy.pda.android_pharmacy.mvvm.presenter.staticH.StaticTaskPresenter;
import cn.wowjoy.pda.android_pharmacy.mvvm.vm.staticH.StaticTaskViewModel;
import cn.wowjoy.pda.android_pharmacy.ui.activity.LoginActivity;
import cn.wowjoy.pda.android_pharmacy.ui.activity.hospital.InHospitalTaskActivity;
import cn.wowjoy.pda.android_pharmacy.ui.activity.staticH.check.StaticCheckIndexActivity;
import cn.wowjoy.pda.android_pharmacy.ui.activity.staticH.put.StaticPutIndexActivity;
import cn.wowjoy.pda.android_pharmacy.ui.activity.staticH.send.StaticSendIndexActivity;
import cn.wowjoy.pda.android_pharmacy.ui.activity.staticH.take.StaticTakeIndexActivity;

public class StaticTaskActivity extends BaseActivity<ActivityStaticTaskBinding,StaticTaskViewModel,StaticTaskPresenter> implements View.OnClickListener {

    @Override
    protected void init(Bundle savedInstanceState) {
        binding.taskTitle.titleTextTv.setText("静配药房");
        binding.taskTitle.titleBackTv.setText("");
        binding.taskTitle.titleBackLl.setVisibility(View.VISIBLE);
        binding.taskTitle.titleBackLl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        binding.rlTaslTake.setOnClickListener(this);
        binding.rlTaskCheck.setOnClickListener(this);
        binding.rlTaslPut.setOnClickListener(this);
        binding.rlTaslSend.setOnClickListener(this);
        binding.btExit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(StaticTaskActivity.this, LoginActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);
                finish();
            }
        });
        //TODO:个人信息的更新
//        Log.e("PXY", "setPersonal: "+ PreferenceManager.getInstance().getLUserName() +"  getLUserNum:"+   PreferenceManager.getInstance().getLUserNum());
        if(!PreferenceManager.getInstance().getLUserName().equals("") && !PreferenceManager.getInstance().getLUserNum().equals("")){
            binding.tvTaskEmployeeName.setText(PreferenceManager.getInstance().getLUserName());
            binding.tvTaskEmployeeId.setText(PreferenceManager.getInstance().getLUserNum());
        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_static_task;
    }

    @Override
    protected Class<StaticTaskPresenter> getPresenterClass() {
        return StaticTaskPresenter.class;
    }

    @Override
    protected Class<StaticTaskViewModel> getViewModelClass() {
        return StaticTaskViewModel.class;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.rl_tasl_take:
                startActivity(new Intent(StaticTaskActivity.this, StaticTakeIndexActivity.class));
                break;
            case R.id.rl_task_check:
                startActivity(new Intent(StaticTaskActivity.this, StaticCheckIndexActivity.class));
                break;
            case R.id.rl_tasl_put:
                startActivity(new Intent(StaticTaskActivity.this, StaticPutIndexActivity.class));
                break;
            case R.id.rl_tasl_send:
                startActivity(new Intent(StaticTaskActivity.this, StaticSendIndexActivity.class));
                break;
        }
    }
}
